<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" 
      xmlns:sec="http://www.pollix.at/thymeleaf/shiro">
<head th:replace="admin/common/html/tableHead :: head(~{::title},~{::link},~{::style})">

<title th:text=${title}></title>
<!-- 这儿引用单独的css link -->
<!-- Ladda for Bootstrap 3按钮加载进度插件 -->
<link rel="stylesheet" th:href="@{/static/admin/assets/js/button/ladda/ladda.min.css}">
<!-- bootstrap-table表单样式 -->
<link th:href="@{/static/admin/assets/js/bootstrap/css/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet"/>
<!-- 用户界面自定义css -->
<link th:href="@{/static/admin/user/css/user-add.css}" rel="stylesheet"/>

<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.all.min.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="/ueditor/lang/zh-cn/zh-cn.js"></script>

<style type="text/css"></style>
</head>

<body>

<div class="content-wrap">
	<div class="row">
		<div class="col-sm-12">
			<div class="nest" id="elementClose">
				<div class="">
				</div>
				<div class="body-nest" id="element">
					<div class="panel-body">
						<form  class="form-horizontal m" id="form-add">
							<div class="form-group">
								<label class="col-sm-3 control-label ">接收人电子邮件：</label>
								<div class="col-sm-8">
									<input class="form-control" type="text" id="receiversEmail" name="receiversEmail"/>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label ">邮件标题：</label>
								<div class="col-sm-8">
									<input class="form-control" type="text" id="title" name="title"/>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label ">内容：</label>
								<div class="col-sm-8">
									<script id="editor" type="text/plain" name="content" style="width:1024px;height:500px;"></script>
								</div>
							</div>
								
							<div class="form-group">
								<div class="form-control-static col-sm-offset-9">
									<button type="submit" class="btn btn-primary">提交</button>
									<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<!-- 通用js -->
<div th:include="admin/common/html/js :: onload_js">
   
</div>


<!-- 弹窗 -->
<script  th:src="@{/static/admin/assets/js/layer/layer.js}" type="text/javascript"></script>
<!-- 遮罩层 -->
<script  th:src="@{/static/admin/assets/js/blockUI/jquery.blockUI.js}" type="text/javascript"></script>
<script th:src="@{/static/admin/assets/js/bootstrap/js/base_list.js}" type="text/javascript"></script>


<!--ueditor的配置文件-->
<script type="text/javascript" charset="utf-8" th:src="@{/static/admin//ueditor/ueditor.config.js}"></script>
<!--ueditor核心文件-->
<script type="text/javascript" charset="utf-8" th:src="@{/static/admin//ueditor/ueditor.all.min.js}"> </script>
<!--ueditor语言文件-->
<script type="text/javascript" charset="utf-8" th:src="@{/static/admin//ueditor/lang/zh-cn/zh-cn.js}"></script>

<script type="text/javascript">

$("#form-add").validate({
	rules:{
		receiversEmail:{
			required:true,
			 email: true
		},
		title:{
			required:true,
			minlength: 2,
			maxlength: 20,
		}
	},
	messages: {
        "title": {
            remote: "标题必填"
        }
    },
	submitHandler:function(form){
		add();
	}
});

/**
 * 用户添加方法
 */
function add() {
	var dataFormJson=$("#form-add").serialize();
	$.ajax({
		cache : true,
		type : "POST",
		url : rootPath + "/EmailController/add",
		data : dataFormJson,
		async : false,
		error : function(request) {
			$.modal.alertError("系统错误");
		},
		success : function(data) {
			$.operate.saveSuccess(data);
		}
	});
}


</script>

<script type="text/javascript">
	var x=window.rootPath;
    var ue = UE.getEditor('editor');
</script>
</body>


</html>
